/**
 * 
 */

package com.xxxx.game;

import java.util.Vector;

import android.graphics.Canvas;
/**
 * @author HuXiaolong
 *
 */
public class CompactDrawing implements ICanvasDrawing
{
	private Vector<ICanvasDrawing> mDrawings = new Vector<ICanvasDrawing>();

	public Vector<ICanvasDrawing> getDrawings()
	{
		return mDrawings;
	}

	@Override
	public boolean paint(Canvas canvas, ISprite sprite)
	{
		Vector<ICanvasDrawing> toremove = new Vector<ICanvasDrawing>();
		toremove.add(null);
		for (ICanvasDrawing cd : mDrawings)
		{
			if (cd != null && !cd.paint(canvas, sprite))
			{
				toremove.add(cd);
			}
		}
		for (ICanvasDrawing x : toremove)
		{
			mDrawings.remove(x);
		}
		//mDrawings.removeAll(toremove);
		return !mDrawings.isEmpty();
	}
	
	@Override
	public String getName()
	{
		return "CompactDrawing";
	}
}
